package com.tl.commonlibrary.storage.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.tl.commonlibrary.storage.database.dao.DaoMaster;
import com.tl.commonlibrary.storage.database.dao.UserDao;

import org.greenrobot.greendao.database.Database;

/**
 * Created by Administrator on 2017/6/5 0005.
 */

public class OpenHelper extends DaoMaster.OpenHelper {
    /**
     * 1.3.4 版本变更
     * {@link com.tl.commonlibrary.ui.beans.User}:新增字段cityStr,vip
     */
    public static final int VERSION_1_3_4 = 2;

    public OpenHelper(Context context, String name) {
        super(context, name);
    }

    public OpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory);
    }

    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
        if (oldVersion < VERSION_1_3_4) {
            MigrationHelper.getInstance().migrate(db, UserDao.class);
        }

    }
}
